package cn.xutils.boxposed.app

import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Base64
import android.util.Log
import android.widget.TextView
import cn.xutils.boxposed.app.databinding.ActivityMainBinding
import cn.xutils.boxposed.app.hook.Hooker

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        try {
            val wwPackageInfo = getPackageManager().getPackageInfo(
                "cn.damai",
                PackageManager.GET_SIGNATURES
            )
            val wwSignature =
                Base64.encodeToString(wwPackageInfo.signatures[0].toByteArray(), Base64.DEFAULT)
            Log.e("wwSignature", wwSignature)
        }
        catch (e : Throwable){
            Log.e("", "", e)
        }

        // Example of a call to a native method
//        binding.sampleText.text = stringFromJNI()
        Hooker.doTestHook();
    }

    /**
     * A native method that is implemented by the 'app' native library,
     * which is packaged with this application.
     */
//    external fun stringFromJNI(): String

    companion object {
        // Used to load the 'app' library on application startup.
        init {
            System.loadLibrary("core")
        }
    }
}